import time
def read2list(file):
    file = open(file, 'r')
    l = file.readlines()
    return(l)
def b_mod(a):
    for i in range(len(a)-1):
        for j in range(len(a)-2, i-1, -1):
            if a[j] > a [j+1]:
                a[j], a[j+1] = a[j+1], a[j]
            
m1 = read2list('m1_sorted.txt')
ts = time.time()
b_mod(m1)
tf = time.time()
print('m1_sorted', (tf-ts)*1000, 'millisec.')
m2 = read2list('m2_reverse.txt')
ts = time.time()
b_mod(m2)
tf = time.time()
print('m2_reverse', (tf-ts)*1000, 'millisec.')
m3 = read2list('m3_shuffle.txt')
ts = time.time()
b_mod(m3)
tf = time.time()
print('m3_shuffle', (tf-ts)*1000, 'millisec.')

